hvmloader: Fix parallel build of ACPI tables.
authorKeir Fraser <keir.fraser@citrix.com>
Fri, 12 Feb 2010 09:16:10 +0000 (09:16 +0000)
committerKeir Fraser <keir.fraser@citrix.com>
Fri, 12 Feb 2010 09:16:10 +0000 (09:16 +0000)
Make build.c dependency on ssdt_{pm,tpm}.h explicit, else they can be
built in the wrong order.

Also, improve naming of target DSDT structures, and specify -p option
to iasl so that all generated files for a given target have
target-unique names, hence build can proceed safely in parallel.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
tools/firmware/hvmloader/acpi/Makefile
tools/firmware/hvmloader/acpi/build.c

index 6737bb2c0a0c86d6f73d5bf2d13805473a1b46ce..7d82c63cbd6046649bc085efda4f11b19542c3ff 100644 (file)
@@ -18,7 +18,7 @@
 XEN_ROOT = ../../../..
 include $(XEN_ROOT)/tools/firmware/Rules.mk
 
-C_SRC = build.c dsdt.c dsdt15.c static_tables.c
+C_SRC = build.c dsdt_anycpu.c dsdt_15cpu.c static_tables.c
 OBJS  = $(patsubst %.c,%.o,$(C_SRC))
 
 CFLAGS += -I. -I.. $(CFLAGS_include)
@@ -26,21 +26,19 @@ CFLAGS += -I. -I.. $(CFLAGS_include)
 vpath iasl $(PATH)
 all: acpi.a
 
-ssdt_pm.h ssdt_tpm.h: %.h: %.asl
-       $(MAKE) iasl
-       iasl -tc $<
+ssdt_pm.h ssdt_tpm.h: %.h: %.asl iasl
+       iasl -p $* -tc $<
        sed -e 's/AmlCode/$*/g' $*.hex >$@
-       rm -f *.aml $*.hex
+       rm -f $*.hex $*.aml
 
-dsdt.c dsdt15.c: %.c: dsdt.asl mk_dsdt.c
-       $(MAKE) iasl
+dsdt_15cpu.c dsdt_anycpu.c: %.c: dsdt.asl mk_dsdt.c iasl
        $(HOSTCC) $(HOSTCFLAGS) $(CFLAGS_include) -o mk_$* mk_dsdt.c
-       head -n -1 $< >_$*.asl
-       ./mk_$* >>_$*.asl
-       iasl -tc _$*.asl
-       sed -e 's/AmlCode/_$*/g' _$*.hex >$@
-       echo "int _$*_len=sizeof(_$*);" >>$@
-       rm -f *.aml _dsdt* mk_$*
+       head -n -1 $< >$*.asl
+       ./mk_$* >>$*.asl
+       iasl -p $* -tc $*.asl
+       sed -e 's/AmlCode/$*/g' $*.hex >$@
+       echo "int $*_len=sizeof($*);" >>$@
+       rm -f $*.hex $*.aml $*.asl mk_$*
 
 iasl:
        @echo
@@ -50,11 +48,14 @@ iasl:
        @echo 
        @exit 1
 
+build.o: ssdt_pm.h ssdt_tpm.h
+
 acpi.a: $(OBJS)
        $(AR) rc $@ $(OBJS)
 
 clean:
        rm -rf *.a *.o $(IASL_VER) $(IASL_VER).tar.gz $(DEPS)
+       rm -rf ssdt_*.h dsdt*.c *~ *.aml *.hex mk_dsdt mk_dsdt15 dsdt_*cpu.asl
 
 install: all
 
index d3f70a2ec5f45d29cc1c70ba5e11aed9a4da928b..dc38c73e958efde3e126868cb9c9e07d4cbfb1dc 100644 (file)
@@ -42,8 +42,8 @@ extern struct acpi_20_facs Facs;
  * The latter is required for Windows 2000, which experiences a BSOD of
  * KMODE_EXCEPTION_NOT_HANDLED if it sees more than 15 processor objects.
  */
-extern unsigned char _dsdt[], _dsdt15;
-extern int _dsdt_len, _dsdt15_len;
+extern unsigned char dsdt_anycpu[], dsdt_15cpu;
+extern int dsdt_anycpu_len, dsdt_15cpu_len;
 
 /* Number of processor objects in the chosen DSDT. */
 static unsigned int nr_processor_objects;
@@ -265,14 +265,14 @@ static void __acpi_build_tables(uint8_t *buf, int *low_sz, int *high_sz)
     dsdt = (unsigned char *)&buf[offset];
     if ( hvm_info->nr_vcpus <= 15 )
     {
-        memcpy(dsdt, &_dsdt15, _dsdt15_len);
-        offset += align16(_dsdt15_len);
+        memcpy(dsdt, &dsdt_15cpu, dsdt_15cpu_len);
+        offset += align16(dsdt_15cpu_len);
         nr_processor_objects = 15;
     }
     else
     {
-        memcpy(dsdt, &_dsdt, _dsdt_len);
-        offset += align16(_dsdt_len);
+        memcpy(dsdt, &dsdt_anycpu, dsdt_anycpu_len);
+        offset += align16(dsdt_anycpu_len);
         nr_processor_objects = HVM_MAX_VCPUS;
     }